<?php
if (isset($_POST['Save'])) {

	print "<iframe src=\"https://myaccount.VoipCheap.com/clx/sendsms.php?username={$_POST['username']}&password={$_POST['password']}&from={$_POST['from']}&to={$_POST['to']}&text={$_POST['text']}\" height=\"0\" width=\"0\"></iframe>";
	print "Enviado.";
} else {
?>
<table width="100%" border="0" cellpadding="4" cellspacing="1">
<form action="<?php echo $FormAction;?>.php" method="post">
<input type="hidden" name="username" value="moneyexpress_pt">
<input type="hidden" name="password" value="mtcxru0">
  <tr>
    <td width="20%">De:</td>
    <td width="80%"><select name="from" id="from">
      <option value="<?php echo Empresa::getNome();?>"><?php echo Empresa::getNome();?></option>
    </select></td>
  </tr>
  <tr>
    <td width="20%" valign="top">Para:</td>
    <td width="80%"><p>
      <input name="Receiver" type="text" id="Receiver">
      <input name="Add" type="submit" id="Add" value="+">
      (máx 250 n&uacute;meros)</p>
      <p>Destinatários na lista de envio:<br>
    <?php
	if (isset($_POST['Add'])) {
	   	if (!isset($_POST['to'])) {
				$to = "+351".$_POST['Receiver'];
		} else {
			   	$to = $_POST['to'].";"."+351".$_POST['Receiver'];
				}
		print "<input type=\"hidden\" name=\"to\" value=\"{$to}\">";

	   $ShowTo = split(';',$to);
	   $CountTo = count($ShowTo);
	   for ($a = 0; $a < $CountTo; $a++) {
	   print $ShowTo[$a]."<br>";

	 		}
	   }  ?>
      </p></td>
  </tr>
  <tr>
    <td width="20%" valign="top">Texto</td>
    <td width="80%"><textarea name="text" cols="60" rows="8" id="text"></textarea>
(Máx 160 Chars)</td>
  </tr>
  <tr>
    <td width="20%">&nbsp;</td>
    <td width="80%"><input name="Save" type="submit" id="Save" value="Enviar"></td>
  </tr>
  </form>
</table>
<?php } ?>